"""另一种写法"""
import os
import threading


class MyThread(threading.Thread):
    def __init__(self,name):
        threading.Thread.__init__(self)
        self.__name = name

    def run(self):
        print(f"worker 进程 pid = {os.getpid()}")
        print(f"{self.__name} start to work ,子线程:{threading.get_ident()}")

if __name__ == "__main__":
    print(f"主进程pid={os.getpid()},主线程:{threading.get_ident()}")
    name  = "小明"
    th = MyThread(name)
    th.start()
    th.join()